package com.example.benefitcommunity.controller;

import com.example.benefitcommunity.entity.BcComment;
import com.example.benefitcommunity.entity.BcComment;
import com.example.benefitcommunity.entity.Result;
import com.example.benefitcommunity.service.BcCommentService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 评论表(BcComment)表控制层
 *
 * @author makejava
 * @since 2025-08-27 16:40:20
 */
@Tag(name = "评论")
@CrossOrigin
@RestController
@RequestMapping("bcComment")
public class BcCommentController {
    /**
     * 服务对象
     */
    @Resource
    private BcCommentService bcCommentService;

    /**
     * 通过查询数据
     *
     * @param dynamicid   动态id
     * @return 数据
     */
    @Operation(description = "评论查询")
    @GetMapping("list")
    public Result<Object> queryByComment(Integer dynamicid) {
        return this.bcCommentService.queryByComment(dynamicid);
    }

    /**
     * 新增数据
     *
     * @param bcComment 实体
     * @return 新增结果
     */
    @Operation(description = "新增评论")
    @PostMapping("add")
    public Result<Object> add(@RequestBody BcComment bcComment) {
        return this.bcCommentService.insert(bcComment);
    }
}

